local Tabs = {}
function RegisterTab( TabBuildFunction, Text, Description, Silkicon )
	local Temp = {}
	Temp.Function = TabBuildFunction
	Temp.Text = Text
	Temp.Description = Description
	Temp.Silkicon = Silkicon
	table.insert( Tabs, Temp )
end
function TabMenu()
	local DermaPanel = vgui.Create( "DFrame" )
	DermaPanel:SetPos( 55,55 )
	DermaPanel:SetSize( ScrW() - 110, ScrH() - 110 )
	DermaPanel:SetTitle( "Menu" )
	DermaPanel:SetVisible( true )
	DermaPanel:SetDraggable( false )
	DermaPanel:ShowCloseButton( true )
	DermaPanel:SetMouseInputEnabled( true )
	DermaPanel:SetKeyboardInputEnabled( true )
	DermaPanel:MakePopup()
	DermaPanel:SetBackgroundBlur( true )
	local PropertySheet = vgui.Create( "DPropertySheet" )
	PropertySheet:SetParent( DermaPanel )
	PropertySheet:SetPos( 5, 30 )
	PropertySheet:SetSize( ScrW() - 110, ScrH() - 110 )
	HTMLTest = vgui.Create("HTML")
	HTMLTest:SetPos(30,50)
	HTMLTest:SetSize(ScrW() - 160, ScrH() - 160)
	HTMLTest:SetParent( DermaPanel )
	HTMLTest:OpenURL("http://www.agclan.net") // put your website that you want it to display, don't forget the " "
	HTMLTest2 = vgui.Create("HTML")
	HTMLTest2:SetPos(30,50)
	HTMLTest2:SetSize(ScrW() - 160, ScrH() - 160)
	HTMLTest2:SetParent( DermaPanel )
	HTMLTest2:OpenURL("http://www.agclan.net/motd.html") // put your website that you want it to display, don't forget the " "
	if LocalPlayer():IsAdmin() then
		local AdminPanel = vgui.Create( "DPanel", DermaPanel )
		AdminPanel:SetPos( 25, 50 )
		AdminPanel:SetSize( 250, 250 )
		local PlayerComboBox = vgui.Create( "DComboBox", AdminPanel )
		PlayerComboBox:SetPos( 200, 50 )
		PlayerComboBox:SetSize( 250, 500 )
		PlayerComboBox:SetParent( AdminPanel )
		PlayerComboBox:SetMultiple( false ) -- Don't use this unless you know extensive knowledge about tables
		PlayerComboBox:Clear()
	
		for i, v in pairs(player.GetAll()) do
			FPlayer = PlayerComboBox:AddItem( v:Nick() )
			FPlayer.Ply = v:UserID()
		end
		local KickButton= vgui.Create( "DButton" )
		KickButton:SetParent( AdminPanel )
		KickButton:SetText( "Kick" )
		KickButton:SetPos( 25, 50 )
		KickButton:SetSize( 75, 25 )
		KickButton.DoClick = function ()
			if !PlayerComboBox:GetSelected() then return end
			local KickFrame = vgui.Create( "DFrame" )
			KickFrame:SetPos( ScrW() / 2, ScrH() / 2 )
			KickFrame:SetSize( 210, 85 )
			KickFrame:SetTitle( "Kick" )
			KickFrame:SetVisible( true )
			KickFrame:SetDraggable( true )
			KickFrame:ShowCloseButton( true )
			KickFrame:MakePopup()
			local ReasonInput = vgui.Create( "DTextEntry", DermaPanel )
			ReasonInput:SetPos( 23,25 )
			ReasonInput:SetParent( KickFrame )
			ReasonInput:SetTall( 20 )
			ReasonInput:SetWide( 170 )
			ReasonInput:SetEnterAllowed( false )
			ReasonInput:SetValue( "Reason" )
			local OkButton = vgui.Create( "DButton" )
			OkButton:SetParent( KickFrame )
			OkButton:SetText( "OK" )
			OkButton:SetPos( 25, 60 )
			OkButton:SetSize( 75, 25 )
			OkButton.DoClick = function ()
				local userid = PlayerComboBox:GetSelected().Ply
				LocalPlayer():ConCommand( string.Implode(" ", {"sm_kick", "#" .. userid, ReasonInput:GetValue()}) )
				KickFrame:Close()
			end
		end
		local BanButton = vgui.Create( "DButton" )
		BanButton:SetParent( AdminPanel )
		BanButton:SetText( "Ban" )
		BanButton:SetPos( 25, 85 )
		BanButton:SetSize( 75, 25 )
		BanButton.DoClick = function ()
				if !PlayerComboBox:GetSelected() then return end
				  local BanFrame = vgui.Create( "DFrame" )
			BanFrame:SetPos( ScrW() / 2, ScrH() / 2 )
			BanFrame:SetSize( 210, 165 )
			BanFrame:SetTitle( "Ban" )
			BanFrame:SetVisible( true )
			BanFrame:SetDraggable( true )
			BanFrame:ShowCloseButton( true )
			BanFrame:MakePopup()
			local ReasonInput = vgui.Create( "DTextEntry", DermaPanel )
			ReasonInput:SetPos( 23,25 )
			ReasonInput:SetParent( BanFrame )
			ReasonInput:SetTall( 20 )
			ReasonInput:SetWide( 170 )
			ReasonInput:SetEnterAllowed( false )
			ReasonInput:SetValue( "Reason" )
			local NumSliderThingy = vgui.Create( "DNumSlider", DermaPanel )
		NumSliderThingy:SetPos( 23,55 )
		NumSliderThingy:SetSize( 150, 100 ) -- Keep the second number at 100
		NumSliderThingy:SetText( "Ban Time" )
		NumSliderThingy:SetParent( BanFrame )
		NumSliderThingy:SetMin( 0 ) -- Minimum number of the slider
		NumSliderThingy:SetMax( 10080 ) -- Maximum number of the slider
		NumSliderThingy:SetDecimals( 0 ) -- Sets a decimal. Zero means it's a whole number
		local PermaCheckBox = vgui.Create( "DCheckBoxLabel" )
  		PermaCheckBox:SetText( "Perma?" )
 	 	PermaCheckBox:SetValue( 0 )
		PermaCheckBox:SetPos( 23,100 )
		PermaCheckBox:SetParent( BanFrame )
			local OkButton = vgui.Create( "DButton" )
		OkButton:SetParent( BanFrame )
		OkButton:SetText( "OK" )
		OkButton:SetPos( 25, 135 )
		OkButton:SetSize( 75, 25 )
			OkButton.DoClick = function ()
			if PermaCheckBox:GetChecked() then
			NumSliderThingy:SetValue( 0 )
			end
			local userid = PlayerComboBox:GetSelected().Ply
			LocalPlayer():ConCommand( string.Implode(" ", {"sm_ban", "#" .. userid, NumSliderThingy:GetValue(), ReasonInput:GetValue()}) )
			BanFrame:Close()
			end
		end
		local UnBanButton = vgui.Create( "DButton" )
		UnBanButton:SetParent( AdminPanel )
		UnBanButton:SetText( "UnBan" )
		UnBanButton:SetPos( 25, 120 )
		UnBanButton:SetSize( 75, 25 )
			UnBanButton.DoClick = function ()
				local UnBanFrame = vgui.Create( "DFrame" )
				UnBanFrame:SetPos( ScrW() / 2, ScrH() / 2 )
				UnBanFrame:SetSize( 216, 100 )
				UnBanFrame:SetTitle( "UnBan" )
				UnBanFrame:SetVisible( true )
				UnBanFrame:SetDraggable( true )
				UnBanFrame:ShowCloseButton( true )
				UnBanFrame:MakePopup()
				local SteamIdInput = vgui.Create( "DTextEntry", DermaPanel )
				SteamIdInput:SetPos( 23,25 )
				SteamIdInput:SetParent( UnBanFrame )
				SteamIdInput:SetTall( 20 )
				SteamIdInput:SetWide( 170 )
				SteamIdInput:SetEnterAllowed( false )
				SteamIdInput:SetValue( "Steam ID" )

			local OkButton = vgui.Create( "DButton" )
		OkButton:SetParent( UnBanFrame )
		OkButton:SetText( "OK" )
		OkButton:SetPos( 23, 55 )
		OkButton:SetSize( 75, 25 )
			OkButton.DoClick = function ()
				LocalPlayer():ConCommand( string.Implode(" ", {"sm_unban", SteamIdInput:GetValue()}))
				UnBanFrame:Close()
			end
			end
		local AddBanButton = vgui.Create( "DButton" )
		AddBanButton:SetParent( AdminPanel )
		AddBanButton:SetText( "Add Ban" )
		AddBanButton:SetPos( 25, 155 )
		AddBanButton:SetSize( 75, 25 )
		AddBanButton.DoClick = function ()
			local AddBanFrame = vgui.Create( "DFrame" )
			AddBanFrame:SetPos( ScrW() / 2, ScrH() / 2 )
			AddBanFrame:SetSize( 216, 140 )
			AddBanFrame:SetTitle( "Add Ban" )
			AddBanFrame:SetVisible( true )
			AddBanFrame:SetDraggable( true )
			AddBanFrame:ShowCloseButton( true )
			AddBanFrame:MakePopup()
			local SteamIdInput = vgui.Create( "DTextEntry", DermaPanel )
			SteamIdInput:SetPos( 23,25 )
			SteamIdInput:SetParent( AddBanFrame )
			SteamIdInput:SetTall( 20 )
			SteamIdInput:SetWide( 170 )
			SteamIdInput:SetEnterAllowed( false )
			SteamIdInput:SetValue( "Steam ID" )
			local ReasonInput = vgui.Create( "DTextEntry", DermaPanel )
			ReasonInput:SetPos( 23,55 )
			ReasonInput:SetParent( AddBanFrame )
			ReasonInput:SetTall( 20 )
			ReasonInput:SetWide( 170 )
			ReasonInput:SetEnterAllowed( false )
			ReasonInput:SetValue( "Reason" )
			local NumSliderThingy = vgui.Create( "DNumSlider", DermaPanel )
			NumSliderThingy:SetPos( 23,75 )
			NumSliderThingy:SetSize( 150, 100 ) -- Keep the second number at 100
			NumSliderThingy:SetText( "Ban Time" )
			NumSliderThingy:SetParent( AddBanFrame )
			NumSliderThingy:SetMin( 0 ) -- Minimum number of the slider
			NumSliderThingy:SetMax( 10080 ) -- Maximum number of the slider
			NumSliderThingy:SetDecimals( 0 ) -- Sets a decimal. Zero means it's a whole number
			local PermaCheckBox = vgui.Create( "DCheckBoxLabel" )
			PermaCheckBox:SetText( "Perma?" )
			PermaCheckBox:SetValue( 0 )
			PermaCheckBox:SetPos( 108,115 )
			PermaCheckBox:SetParent( AddBanFrame )
			local OkButton = vgui.Create( "DButton" )
			OkButton:SetParent( AddBanFrame )
			OkButton:SetText( "OK" )
			OkButton:SetPos( 23, 115 )
			OkButton:SetSize( 75, 25 )
			OkButton.DoClick = function ()
				if PermaCheckBox:GetChecked() then
					NumSliderThingy:SetValue( 0 )
				end
				LocalPlayer():ConCommand( string.Implode(" ", {"sm_addban", NumSliderThingy:GetValue(), SteamIdInput:GetValue(), ReasonInput:GetValue()}))
				AddBanFrame:Close()
			end
		end
		local RefreshButton = vgui.Create( "DButton" )
		RefreshButton:SetParent( AdminPanel )
		RefreshButton:SetText( "Rehash" )
		RefreshButton:SetPos( 25, 190 )
		RefreshButton:SetSize( 75, 25 )
		RefreshButton.DoClick = function ()
			LocalPlayer():ConCommand( "reload_sb" )
		end
		PropertySheet:AddSheet( "Admin Menu", AdminPanel, "gui/silkicons/group", false, false, "The Admin Menu!!!!!" )
	end
	PropertySheet:AddSheet( "Website", HTMLTest, "gui/silkicons/world", false, false, "Our Website" )
	PropertySheet:AddSheet( "MOTD", HTMLTest2, "gui/silkicons/exclamation", false, false, "Message of the day") 
end
usermessage.Hook( "motd", TabMenu )
function AdminMenu()
	local DermaPanel = vgui.Create( "DFrame" )
	DermaPanel:SetPos( 55,55 )
	DermaPanel:SetSize( 600, 600 )
	DermaPanel:SetTitle( "Admin Menu" )
	DermaPanel:SetVisible( true )
	DermaPanel:SetDraggable( false )
	DermaPanel:ShowCloseButton( true )
	DermaPanel:SetMouseInputEnabled( true )
	DermaPanel:SetKeyboardInputEnabled( true )
	DermaPanel:MakePopup()
	DermaPanel:SetBackgroundBlur( true )
	if !LocalPlayer():IsAdmin() then
		local LabelShit = vgui.Create("DLabel", DermaPanel)
		LabelShit:SetText("Hey buddy, you're not admin. GTFO")
		LabelShit:SizeToContents()
		LabelShit:SetPos(150, 150)
		return
	end
	local PropertySheet = vgui.Create( "DPropertySheet" )
	PropertySheet:SetParent( DermaPanel )
	PropertySheet:SetPos( 5, 30 )
	PropertySheet:SetSize( 590, 565 )
	for k, v in pairs(Tabs) do
		local Temp = vgui.Create( "DPanel", DermaPanel )
		if v.Function then
			v.Function( Temp )
		end
		PropertySheet:AddSheet( v.Text, Temp, v.Silkicon, false, false, v.Description )
	end
end
usermessage.Hook( "agm_menu", AdminMenu )
local tab_plugins = file.FindInLua("agm_tabs/*.lua")
for _, filename in pairs( tab_plugins ) do
	Msg( "Loading: " .. filename .. "\n" )
	include( "agm_tabs/" .. filename )
end